/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.employee.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 新开卡或卡充值提成设定Entity
 * @author liujiang
 * @version 2013-11-13
 */
@Entity
@Table(name = "store_bonus_setting_card")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class StoreBonusSettingCard extends BaseEntity {
	public static final int CARD_TYPE_TIMES = 0;//计次护理卡
	public static final int CARD_TYPE_DURATION = 1;//时段护理卡
	public static final int CARD_TYPE_PRODUCT = 2;//产品充值卡
	public static final int CARD_TYPE_ALL = 3;//综合充值卡
	public static final int BONUS_TYPE_RATE = 0;// 按比例提成
	public static final int BONUS_TYPE_FIXED = 1;//按固定金额提成
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 新开卡或卡充值提成编号
	private Store store; 	// 店面
	private Employee employee;		
	private int card_template_type; // 会员卡模板类型：0： 计次护理卡1： 时段护理卡2： 产品充值卡3： 综合充值卡
	private Long card_template_id;	//会员卡模板编号
	private int bonus_type;	//提成方式：0： 按比例提成1： 按固定金额提成
	private float bonus_rate;	//提成比例，仅当提成方式为按比例提成时才有效。（取值范围：0~1之间的小数，小数点后保留2位）
	private float fixed_money;	//固定提成金额，仅当提成方式为按固定金额提成时才有效。
	
	public StoreBonusSettingCard() {
	}

	public StoreBonusSettingCard(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="STORE_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="EMPLOYEE_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public int getCard_template_type() {
		return card_template_type;
	}

	public void setCard_template_type(int card_template_type) {
		this.card_template_type = card_template_type;
	}

	public Long getCard_template_id() {
		return card_template_id;
	}

	public void setCard_template_id(Long card_template_id) {
		this.card_template_id = card_template_id;
	}

	public int getBonus_type() {
		return bonus_type;
	}

	public void setBonus_type(int bonus_type) {
		this.bonus_type = bonus_type;
	}

	public float getBonus_rate() {
		return bonus_rate;
	}

	public void setBonus_rate(float bonus_rate) {
		this.bonus_rate = bonus_rate;
	}

	public float getFixed_money() {
		return fixed_money;
	}

	public void setFixed_money(float fixed_money) {
		this.fixed_money = fixed_money;
	}
	
}


